<template>
  <div class="newsinfo">
    <h3 class="title">{{newsinfo.title}}</h3>
    <p class="subtitle">
      <span>发表时间:{{newsinfo.add_time}}</span>
      <span>点击次数：{{newsinfo.click}}次</span>
    </p>
    <hr>
    <div class="content" v-html="newsinfo.content">

    </div>
    <comment :id="id"></comment>
  </div>
</template>
<script>
  import    comment    from '../subcoment/comment.vue'
  export default ({
    data() {
      return {
        id: this.$route.params.id,
        newsinfo:[]
      }
    },
    created() {
      this.getnewsinfo();
    },
    methods: {
      getnewsinfo() {
        this.$axios.get('/getnew/' + this.id).then(data => {
          if (data.data.status == 0) {
            console.log(data);
            this.newsinfo=data.data.message[0];
          }
        }).catch(error => {

        })
      }
    },
    components:{
      comment
    }
  })
</script>
<style>
  .newsinfo {
    padding: 0 4px;

  }

  .newsinfo .title {
    font-size: 14px;
    color: red;
    margin: 10px;
    text-align: center;
  }

  .newsinfo .subtitle {
    display: flex;
    justify-content: space-between;
    color: #007AFF
  }
  .newsinfo  img{
    width: 100%;
    height: 100%;
  }
</style>
